This is Mustamäe, a typical Soviet apartment block part of Tallinn.
There isn't room to build without tearing down old buildings. In order to tear down old buildings one would have to buy all the apartments (as I said before individual flats are private property of different people) in the building which is practically impossible because there would be many people who wouldn't want to leave their home. So in the end buying all the apartments, tearing down a building and building a new one would mean that the flats in the new building would be hugely expensive to make up for all the cost and noone would buy them. No real estate developer is crazy enough to try it. They have trouble selling new flats that are in buildings that were built on free land and thus less expensive.
As ugly, boring or inefficient they may be, right now there is no viable alternative to them.